/*******************************************************************************
 * @file Table.h
 * Definition of the CTable class.
 * 
 * @package Dining.
 * 
 * @author mk
 * @date 03/01/2008 13:50:21
 * @version 0.1
 ******************************************************************************/

#ifndef __TABLE_H_INCLUDE__
#define __TABLE_H_INCLUDE__

#include <vector>

#include "Food.h"
#ifndef __MSVC_COMPILER_RECOGNIZES_CORRECT_FORWARD_DECLARATION__
#include "Spoon.h"
#endif

/** @brief Project related classes are scoped by this namespace. */
namespace Dining
{
	
#ifdef __MSVC_COMPILER_RECOGNIZES_CORRECT_FORWARD_DECLARATION__
	class CSpoon;
#endif
	class CPhilosoph;

	/** @brief Class for defining a table. */	
	class CTable
	{
	public:
		/** 
		Default constructor. Conversion disallowed.
		@code
		#include "Table.h"	// for CTable

		int main()
		{
			using namespace Dining;
			CTable* t = new CTable();
			t->Start();
			delete t;
			return 0;
		}
		@endcode
		@param aCount : count of the philosops (default is 5)
		@param aPortions : count of portions the philosophs can eat (default is 10)
		*/
		explicit CTable(unsigned int aCount = 5, unsigned int aPortions = 10);
		
		/** Destructor. */
		~CTable();
		
		/** Start dining by calling this function. */
		void Start();
		
	private:
		/** Asignment operator made private for disallowing copy assignment. */
		CTable& operator= (const CTable& /*aTable*/);

		/** Copy constructor made private for disallowing copy construction. */
		CTable(const CTable& /*aTable*/);

		typedef std::vector<CSpoon*> Spoons;
		typedef std::vector<CPhilosoph*> Philosophs;
	 	
	 	const unsigned int m_Count;		///< has a constant amount of places
		Spoons m_Spoons;				///< has a constant amount of spoons
		Philosophs m_Philosophs;		///< has a constant amount of philosophers
		volatile CFood m_Food;			///< has a constant amount of food;		
	};	
}

#endif /* __TABLE_H_INCLUDE__ */
